package com.flyco.dialog.widget;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.TextView;
import com.flyco.dialog.entity.DialogMenuItem;
import com.flyco.dialog.listener.OnOperItemClickL;
import com.flyco.dialog.utils.CornerUtils;
import com.flyco.dialog.widget.base.BaseDialog;
import java.util.ArrayList;

public class NormalListDialog extends BaseDialog
{
  private BaseAdapter adapter;
  private ArrayList<DialogMenuItem> contents = new ArrayList();
  private float cornerRadius_DP = 5.0F;
  private int dividerColor = -3355444;
  private float dividerHeight_DP = 0.8F;
  private boolean isTitleShow = true;
  private int itemExtraBottom;
  private int itemExtraLeft;
  private int itemExtraRight;
  private int itemExtraTop;
  private int itemPressColor = Color.parseColor("#ffcccccc");
  private int itemTextColor = Color.parseColor("#303030");
  private float itemTextSize_SP = 15.0F;
  private LayoutAnimationController lac;
  private ListView lv;
  private int lvBgColor = Color.parseColor("#ffffff");
  private OnOperItemClickL onOperItemClickL;
  private String title = "提示";
  private int titleBgColor = Color.parseColor("#303030");
  private int titleTextColor = Color.parseColor("#ffffff");
  private float titleTextSize_SP = 16.5F;
  private TextView tv_title;

  public NormalListDialog(Context paramContext, BaseAdapter paramBaseAdapter)
  {
    super(paramContext);
    this.adapter = paramBaseAdapter;
  }

  public NormalListDialog(Context paramContext, ArrayList<DialogMenuItem> paramArrayList)
  {
    super(paramContext);
    this.contents.addAll(paramArrayList);
  }

  public NormalListDialog(Context paramContext, String[] paramArrayOfString)
  {
    super(paramContext);
    this.contents = new ArrayList();
    int i = paramArrayOfString.length;
    for (int j = 0; j < i; j++)
    {
      DialogMenuItem localDialogMenuItem = new DialogMenuItem(paramArrayOfString[j], 0);
      this.contents.add(localDialogMenuItem);
    }
  }

  public NormalListDialog cornerRadius(float paramFloat)
  {
    this.cornerRadius_DP = paramFloat;
    return this;
  }

  public NormalListDialog dividerColor(int paramInt)
  {
    this.dividerColor = paramInt;
    return this;
  }

  public NormalListDialog dividerHeight(float paramFloat)
  {
    this.dividerHeight_DP = paramFloat;
    return this;
  }

  public NormalListDialog isTitleShow(boolean paramBoolean)
  {
    this.isTitleShow = paramBoolean;
    return this;
  }

  public NormalListDialog itemPressColor(int paramInt)
  {
    this.itemPressColor = paramInt;
    return this;
  }

  public NormalListDialog itemTextColor(int paramInt)
  {
    this.itemTextColor = paramInt;
    return this;
  }

  public NormalListDialog itemTextSize(float paramFloat)
  {
    this.itemTextSize_SP = paramFloat;
    return this;
  }

  public NormalListDialog layoutAnimation(LayoutAnimationController paramLayoutAnimationController)
  {
    this.lac = paramLayoutAnimationController;
    return this;
  }

  public NormalListDialog lvBgColor(int paramInt)
  {
    this.lvBgColor = paramInt;
    return this;
  }

  public View onCreateView()
  {
    widthScale(0.8F);
    LinearLayout localLinearLayout = new LinearLayout(this.context);
    localLinearLayout.setOrientation(1);
    this.tv_title = new TextView(this.context);
    this.tv_title.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
    this.tv_title.setSingleLine(true);
    this.tv_title.setPadding(dp2px(18.0F), dp2px(10.0F), 0, dp2px(10.0F));
    localLinearLayout.addView(this.tv_title);
    this.lv = new ListView(this.context);
    this.lv.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
    this.lv.setCacheColorHint(0);
    this.lv.setFadingEdgeLength(0);
    this.lv.setVerticalScrollBarEnabled(false);
    this.lv.setSelector(new ColorDrawable(0));
    localLinearLayout.addView(this.lv);
    TranslateAnimation localTranslateAnimation = new TranslateAnimation(1, 2.0F, 1, 0.0F, 1, 0.0F, 1, 0.0F);
    localTranslateAnimation.setInterpolator(new DecelerateInterpolator());
    localTranslateAnimation.setDuration(550L);
    this.lac = new LayoutAnimationController(localTranslateAnimation, 0.12F);
    this.lac.setInterpolator(new DecelerateInterpolator());
    return localLinearLayout;
  }

  public NormalListDialog setItemExtraPadding(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.itemExtraLeft = dp2px(paramInt1);
    this.itemExtraTop = dp2px(paramInt2);
    this.itemExtraRight = dp2px(paramInt3);
    this.itemExtraBottom = dp2px(paramInt4);
    return this;
  }

  public void setOnOperItemClickL(OnOperItemClickL paramOnOperItemClickL)
  {
    this.onOperItemClickL = paramOnOperItemClickL;
  }

  public boolean setUiBeforShow()
  {
    float f = dp2px(this.cornerRadius_DP);
    this.tv_title.setBackgroundDrawable(CornerUtils.cornerDrawable(this.titleBgColor, new float[] { f, f, f, f, 0.0F, 0.0F, 0.0F, 0.0F }));
    this.tv_title.setText(this.title);
    this.tv_title.setTextSize(2, this.titleTextSize_SP);
    this.tv_title.setTextColor(this.titleTextColor);
    TextView localTextView = this.tv_title;
    int i;
    if (this.isTitleShow)
    {
      i = 0;
      localTextView.setVisibility(i);
      this.lv.setDivider(new ColorDrawable(this.dividerColor));
      this.lv.setDividerHeight(dp2px(this.dividerHeight_DP));
      if (!this.isTitleShow)
        break label271;
      this.lv.setBackgroundDrawable(CornerUtils.cornerDrawable(this.lvBgColor, new float[] { 0.0F, 0.0F, 0.0F, 0.0F, f, f, f, f }));
    }
    while (true)
    {
      if (this.adapter == null)
        this.adapter = new ListDialogAdapter();
      this.lv.setAdapter(this.adapter);
      this.lv.setOnItemClickListener(new AdapterView.OnItemClickListener()
      {
        public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
        {
          if (NormalListDialog.this.onOperItemClickL != null)
            NormalListDialog.this.onOperItemClickL.onOperItemClick(paramAnonymousAdapterView, paramAnonymousView, paramAnonymousInt, paramAnonymousLong);
        }
      });
      this.lv.setLayoutAnimation(this.lac);
      return false;
      i = 8;
      break;
      label271: this.lv.setBackgroundDrawable(CornerUtils.cornerDrawable(this.lvBgColor, f));
    }
  }

  public NormalListDialog title(String paramString)
  {
    this.title = paramString;
    return this;
  }

  public NormalListDialog titleBgColor(int paramInt)
  {
    this.titleBgColor = paramInt;
    return this;
  }

  public NormalListDialog titleTextColor(int paramInt)
  {
    this.titleTextColor = paramInt;
    return this;
  }

  public NormalListDialog titleTextSize_SP(float paramFloat)
  {
    this.titleTextSize_SP = paramFloat;
    return this;
  }

  class ListDialogAdapter extends BaseAdapter
  {
    ListDialogAdapter()
    {
    }

    public int getCount()
    {
      return NormalListDialog.this.contents.size();
    }

    public Object getItem(int paramInt)
    {
      return null;
    }

    public long getItemId(int paramInt)
    {
      return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      DialogMenuItem localDialogMenuItem = (DialogMenuItem)NormalListDialog.this.contents.get(paramInt);
      LinearLayout localLinearLayout = new LinearLayout(NormalListDialog.this.context);
      localLinearLayout.setOrientation(0);
      localLinearLayout.setGravity(16);
      ImageView localImageView = new ImageView(NormalListDialog.this.context);
      localImageView.setPadding(0, 0, NormalListDialog.this.dp2px(15.0F), 0);
      localLinearLayout.addView(localImageView);
      TextView localTextView = new TextView(NormalListDialog.this.context);
      localTextView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView.setSingleLine(true);
      localTextView.setTextColor(NormalListDialog.this.itemTextColor);
      localTextView.setTextSize(2, NormalListDialog.this.itemTextSize_SP);
      localLinearLayout.addView(localTextView);
      float f = NormalListDialog.this.dp2px(NormalListDialog.this.cornerRadius_DP);
      boolean bool;
      label224: int i;
      if (NormalListDialog.this.isTitleShow)
      {
        int n = NormalListDialog.this.itemPressColor;
        if (paramInt == -1 + NormalListDialog.this.contents.size())
        {
          bool = true;
          localLinearLayout.setBackgroundDrawable(CornerUtils.listItemSelector(f, 0, n, bool));
          if (localDialogMenuItem.resId != 0)
            break label389;
          i = NormalListDialog.this.dp2px(18.0F);
          label243: int j = NormalListDialog.this.dp2px(10.0F);
          int k = NormalListDialog.this.dp2px(10.0F);
          localLinearLayout.setPadding(i + NormalListDialog.this.itemExtraLeft, j + NormalListDialog.this.itemExtraTop, 0 + NormalListDialog.this.itemExtraRight, k + NormalListDialog.this.itemExtraBottom);
          localImageView.setImageResource(localDialogMenuItem.resId);
          localTextView.setText(localDialogMenuItem.operName);
          if (localDialogMenuItem.resId != 0)
            break label403;
        }
      }
      label389: label403: for (int m = 8; ; m = 0)
      {
        localImageView.setVisibility(m);
        return localLinearLayout;
        bool = false;
        break;
        localLinearLayout.setBackgroundDrawable(CornerUtils.listItemSelector(f, 0, NormalListDialog.this.itemPressColor, NormalListDialog.this.contents.size(), paramInt));
        break label224;
        i = NormalListDialog.this.dp2px(16.0F);
        break label243;
      }
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.flyco.dialog.widget.NormalListDialog
 * JD-Core Version:    0.6.2
 */